<template>
  <div>
    <iframe id="my-iframe" src="http://172.18.65.239:30080/course/list"></iframe>
  </div>
</template>

<script>
export default {
  mounted() {
    const iframe = document.getElementById("my-iframe");

    iframe.addEventListener("load", () => {
      try {
        const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
        const links = iframeDoc.getElementsByTagName("a");

        for (let i = 0; i < links.length; i++) {
          links[i].addEventListener("click", (event) => {
            event.preventDefault();
            iframe.src = event.currentTarget.href;
          });
        }
      } catch (error) {
        console.error("Error:", error);
      }
    });
  },
};
</script>

<style>
iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none; /* optional */
}
</style>
